{% extends 'base.html' %}
{% load i18n %}

{% block title %}{{ page_title }} - {{ block.super }}{% endblock %}

{% block content %}
<div class="d-flex justify-content-between align-items-center mb-3 flex-wrap">
    <h1 class="h2 text-primary mb-0"><i class="bi bi-journal-richtext me-2"></i> {{ record.rice_variety }}</h1>
    <div class="btn-group mt-2 mt-md-0" role="group" aria-label="Record Actions">
        <a href="{% url 'planting_records:record_edit' record.pk %}" class="btn btn-sm btn-outline-primary"><i class="bi bi-pencil-square"></i> {% trans "编辑" %}</a>
        <a href="{% url 'planting_records:record_delete' record.pk %}" class="btn btn-sm btn-outline-danger"><i class="bi bi-trash"></i> {% trans "删除" %}</a>
    </div>
</div>

<div class="card shadow-sm">
    <div class="card-header">{% trans "种植详情" %}</div>
    <div class="card-body">
        <dl class="row">
            <dt class="col-sm-3">{% trans "水稻品种" %}</dt><dd class="col-sm-9">{{ record.rice_variety }}</dd>
            <dt class="col-sm-3">{% trans "所属田块" %}</dt><dd class="col-sm-9"><a href="{{ record.field.get_absolute_url }}">{{ record.field.name }}</a></dd>
            <dt class="col-sm-3">{% trans "种植日期" %}</dt><dd class="col-sm-9">{{ record.planting_date|date:"Y-m-d" }}</dd>
            <dt class="col-sm-3">{% trans "种植方式" %}</dt><dd class="col-sm-9">{{ record.get_planting_method_display }}</dd>
            <dt class="col-sm-3">{% trans "秧苗/种子来源" %}</dt><dd class="col-sm-9">{{ record.seedling_source|default:_("N/A") }}</dd>
            <dt class="col-sm-3">{% trans "预计收获日期" %}</dt><dd class="col-sm-9">{{ record.expected_harvest_date|date:"Y-m-d"|default:_("N/A") }}</dd>
            <dt class="col-sm-3">{% trans "备注" %}</dt><dd class="col-sm-9">{{ record.notes|linebreaksbr|default:_("无") }}</dd>
            <dt class="col-sm-3">{% trans "记录人" %}</dt><dd class="col-sm-9">{{ record.owner.username }}</dd>
        </dl>
         <small class="text-muted d-block text-end">
             {% trans "创建时间" %}: {{ record.created_at|date:"Y-m-d H:i" }} | {% trans "最后更新" %}: {{ record.updated_at|date:"Y-m-d H:i" }}
         </small>
    </div>
</div>

<div class="mt-4">
    {# Link back to the field detail page #}
    <a href="{{ record.field.get_absolute_url }}" class="btn btn-secondary me-2"><i class="bi bi-arrow-left-circle"></i> {% trans "返回田块详情" %}</a>
    {# Link back to the records list #}
    <a href="{% url 'planting_records:record_list' %}" class="btn btn-outline-secondary"><i class="bi bi-list-ul"></i> {% trans "查看所有记录" %}</a>
</div>

{% endblock %}